maintainer="Sertonix <sertonix@posteo.net>"
pkgname=dinit
pkgver=0.19.1
pkgrel=1
pkgdesc="Service monitoring/init system"
url="https://github.com/davmac314/dinit"
arch="all"
license="Apache-2.0"
subpackages="$pkgname-dbg $pkgname-doc $pkgname-shutdown:_shutdown"
makedepends="m4"
source="$pkgname-$pkgver.tar.gz::https://github.com/davmac314/dinit/archive/refs/tags/v$pkgver.tar.gz"

prepare() {
	default_prepare
	CXXFLAGS="$CXXFLAGS -fno-rtti -flto" \
	./configure \
		--platform=Linux \
		--exec-prefix=/usr \
		--disable-strip \
		--shutdown-prefix=dinit-
}

build() {
	make
}

check() {
	make check
}

package() {
	make DESTDIR="$pkgdir" install
}

_shutdown() {
	pkgdesc="dinit shutdown utils"
	depends="$pkgname=$pkgver-r$pkgrel"

	amove usr/sbin/dinit-shutdown
	amove usr/sbin/dinit-halt
	amove usr/sbin/dinit-reboot
	amove usr/sbin/dinit-soft-reboot
	amove usr/sbin/dinit-poweroff
}

sha512sums="
a496dd8189165baaf84e40072478bc316c9260434fce88ac276741de30511cf7d8802962fdad59525b25f7f748891c55aecac6830517c29fc9baadd60c731a99  dinit-0.19.1.tar.gz
"
